Skip to content

Conversation

@thecrypticace
Copy link
Contributor

Fixes #19250

When converting a JS config to a series of theme keys we special case a key of 1, treat it as if it were tuple access, and turn that into nested theme keys.

This isn't 100% correct though because a user can use 1 in an object instead of an array — in which case we should generate normal theme keys with a 1 in the variable name instead of one with a nested theme key separator (--).

Because the conversion works based on key paths we need to treat a path like colors.a.1.b as both --color-a-1-b and --color-a--b. This ensures a utility like text-a-1-b works as expected.

@thecrypticace thecrypticace marked this pull request as ready for review November 4, 2025 16:30
@thecrypticace thecrypticace requested a review from a team as a code owner November 4, 2025 16:30
Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense. It's gross, sure, but at least it's contained in the compat layer.

@thecrypticace
Copy link
Contributor Author

I'm gonna try to come up with a better design for this because I'm not a big fan of this implementation. I'd like to use actual type information when generating the theme keys from the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4: A theme key of 1 does not work in JS configs

3 participants